<template>
    <!-- 压缩视频大小 -->
    <el-button @click="addTextClick" type="primary">
        {{ '压缩视频' }}
    </el-button>
</template>
<script>
import { videoLower, getFirstFrame } from '@/module/useFfmpeg';
export default {
    props:['obj'],
    methods: {
        async addTextClick() {
            const fileName = `video${this.obj.videoId++}`
            const selectItem = this.obj.videoList[this.obj.videoSelected];
            // 需先上传视频
            if (!selectItem) {
                alert('请先上传视频')
                return
            }
            const videoUrl = await videoLower(
                selectItem.videoUrl,
                selectItem.fileName
            )
            const { url: coverUrl, videoInfo } = await getFirstFrame(
                videoUrl,
                fileName
            )
            this.obj.videoList.push({
                videoUrl,
                coverUrl,
                fileName,
                videoInfo
            })
        }
    }
}
</script>